// pages/map/map.js
Page({
  data:{
      markers:[{
          id:0,
          iconPath:'/images/marker.png',
          longitude: 112.938814,
          latitude:28.228209,
          width:40,
          height:40,
          rotate:90,
          alpha:.6,
          title:'我在这里'
      }],
      polyline:[{
          points: [{
              longitude: 112.938814,
              latitude: 28.228209
          },{
              longitude: 112.918814,
              latitude: 28.238209
          }], 
              color:"#ff6600",
              width: 20,
              dottedLine: false
          }]
  },
  onLoad:function(options){
      this.getLocation();
  },
  getLocation:function(){
      wx.getLocation({
        type: 'gcj02',
        success: function(res){
            var longitude = res.longitude;
            var latitude = res.latitude;
            this.setData({longitude:longitude,latitude:latitude})
        }.bind(this)
      })
  },
  onMapTap:function(event){
      
  },
  onMarkTap:function(event){    
      //打开微信内置的地图
      wx.openLocation({
          latitude: this.data.latitude, 
          longitude: this.data.longitude, 
          scale: 28
      })
      //返回标记点id
      console.log(event.id)
  }
})